#仿射变换
import cv2
import numpy as np

cat = cv2.imread("surprise.jpg")
h, w, ch = cat.shape

#获取变换矩阵  ,中心点是x,y
M = cv2.getRotationMatrix2D((w/2, h/2), 15, 1)

#获取变换矩阵  通过三个点的坐标
pts1 = np.float32([[50, 50], [200, 50], [50, 200]])
pts2 = np.float32([[10, 100], [200, 50], [100, 250]])
M2 = cv2.getAffineTransform(pts1, pts2)

dst = cv2.warpAffine(cat, M2, (w, h))

cv2.imshow("cat", cat)
cv2.imshow("dst", dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
